From 65209da4867bc9c88f8d311c9f16c4dc682ab16d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Tue, 11 Jul 2017 18:20:48 +0200 Subject: [PATCH] widget: Set :focus on focus children --- gtk/gtkwidget.c | 7 ++++++- gtk/theme/Adwaita/_common.scss | 6 ++++-- gtk/theme/Adwaita/gtk-contained-dark.css | 4 +++- gtk/theme/Adwaita/gtk-contained.css | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index dee81a70a0..b966dc57dc 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -15343,7 +15343,6 @@ gtk_widget_snapshot (GtkWidget *widget, cairo_destroy (cr); } - if (gtk_widget_has_visible_focus (widget)) { gtk_snapshot_offset (snapshot, margin.left, margin.top); @@ -15632,6 +15631,12 @@ gtk_widget_set_focus_child (GtkWidget *widget, g_return_if_fail (gtk_widget_get_parent (child) == widget); } + if (priv->focus_child) + gtk_widget_unset_state_flags (priv->focus_child, GTK_STATE_FLAG_FOCUSED); + + if (child) + gtk_widget_set_state_flags (child, GTK_STATE_FLAG_FOCUSED, FALSE); + g_set_object (&priv->focus_child, child); if (GTK_IS_CONTAINER (widget)) diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss index b604c146da..dea9211a18 100644 --- a/gtk/theme/Adwaita/_common.scss +++ b/gtk/theme/Adwaita/_common.scss @@ -10,6 +10,10 @@ $button_transition: all 200ms $ease-out-quad; * { padding: 0; + -gtk-secondary-caret-color: $selected_bg_color +} + +*:focus { // We use the outline properties to signal the focus properties // to the adwaita engine: using real CSS properties is faster, // and we don't use any outlines for now. @@ -19,8 +23,6 @@ $button_transition: all 200ms $ease-out-quad; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; - - -gtk-secondary-caret-color: $selected_bg_color } diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css index 826937db40..e066a6668c 100644 --- a/gtk/theme/Adwaita/gtk-contained-dark.css +++ b/gtk/theme/Adwaita/gtk-contained-dark.css @@ -1,4 +1,6 @@ -* { padding: 0; outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; -gtk-secondary-caret-color: #215d9c; } +* { padding: 0; -gtk-secondary-caret-color: #215d9c; } + +*:focus { outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; } /*************** Base States * */ .background { color: #eeeeec; background-color: #33393b; } diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css index d94b3db653..82da84514b 100644 --- a/gtk/theme/Adwaita/gtk-contained.css +++ b/gtk/theme/Adwaita/gtk-contained.css @@ -1,4 +1,6 @@ -* { padding: 0; outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; -gtk-secondary-caret-color: #4a90d9; } +* { padding: 0; -gtk-secondary-caret-color: #4a90d9; } + +*:focus { outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; } /*************** Base States * */ .background { color: #2e3436; background-color: #e8e8e7; } -- 2.30.2